<?php
class Empleado_model extends Model
{
    function create()
    {
        $new_member_insert_data = array(
            'carnet' => $this->input->post('carnet'),
            'nombre' => $this->input->post('nombre'),
            'apellido1' => $this->input->post('apellido1'),
            'apellido2' => $this->input->post('apellido2'),
            'direccion'=> $this->input->post('direccion'),
            'telefono' => $this->input->post('telefono'),
            'email' => $this->input->post('email'),
            'sexo' => $this->input->post('sexo'),
            'tipo' => $this->input->post('tipo'),
        );
        //  log_message('INFO',"*************".print_r($new_member_insert_data,true));
        $insert = $this->db->insert('empleado', $new_member_insert_data);
        return $insert;
    }

    function modificar()
    {
        $new_member_update_data = array(
            'carnet' => $this->input->post('carnet'),
            'nombre' => $this->input->post('nombre'),
            'apellido1' => $this->input->post('apellido1'),
            'apellido2' => $this->input->post('apellido2'),
            'direccion'=> $this->input->post('direccion'),
            'telefono' => $this->input->post('telefono'),
            'email' => $this->input->post('email'),
            'sexo' => $this->input->post('sexo'),
            'tipo' => $this->input->post('tipo'),
            //'ciudad' => $this->input->post('ciudad')
            //'password' => md5($this->input->post('password'))
        );
        // log_message('INFO',"*************".print_r($new_member_insert_data,true));
        $this->db->where('carnet', $new_member_update_data['carnet']);
        return $this->db->update('empleado', $new_member_update_data);


    }
    function eliminar()
    {
        $carnet = $this->input->post('carnet');
        $this->db->where('carnet', $carnet);
        return $this->db->delete('empleado');
    }


    function obtenerPorId($id)
    {
        $empleado = array();

        $query = $this->db->get_where('empleado',array('carnet' => $id));
        $empleado = $query->result();
        return $empleado;
    }

}